home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / wsanet8a / wsanet / winwhois / winwhois.frm < prev    next >
Text File  |  1996-04-08  |  11KB  |  420 lines

  1. VERSION 2.00
  2. Begin Form Main 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "WinWhois"
  5.    ClientHeight    =   3900
  6.    ClientLeft      =   1005
  7.    ClientTop       =   1695
  8.    ClientWidth     =   7365
  9.    Height          =   4560
  10.    Icon            =   WINWHOIS.FRX:0000
  11.    Left            =   960
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3900
  14.    ScaleWidth      =   7365
  15.    Top             =   1080
  16.    Width           =   7455
  17.    Begin SSPanel PanelLocalName 
  18.       Align           =   1  'Align Top
  19.       Alignment       =   6  'Center - TOP
  20.       BackColor       =   &H00C0C0C0&
  21.       BevelWidth      =   2
  22.       Caption         =   "LocalHost"
  23.       Font3D          =   4  'Inset w/heavy shading
  24.       Height          =   495
  25.       Left            =   0
  26.       MousePointer    =   2  'Cross
  27.       TabIndex        =   0
  28.       Top             =   0
  29.       Width           =   7365
  30.       Begin Label LabelLocalAddr 
  31.          Alignment       =   2  'Center
  32.          BackColor       =   &H00C0C0C0&
  33.          BackStyle       =   0  'Transparent
  34.          Caption         =   "LocalAddr"
  35.          FontBold        =   0   'False
  36.          FontItalic      =   0   'False
  37.          FontName        =   "MS Sans Serif"
  38.          FontSize        =   8.25
  39.          FontStrikethru  =   0   'False
  40.          FontUnderline   =   0   'False
  41.          Height          =   240
  42.          Left            =   120
  43.          TabIndex        =   8
  44.          Top             =   240
  45.          Width           =   7095
  46.       End
  47.    End
  48.    Begin Ini Ini 
  49.       Left            =   120
  50.       Top             =   0
  51.    End
  52.    Begin NetClient NetClient 
  53.       Left            =   600
  54.       LineDelimiter   =   ""
  55.       RecvSize        =   4096
  56.       RecvThreshold   =   0
  57.       RemoteService   =   ""
  58.       Top             =   0
  59.    End
  60.    Begin SSPanel StatusBar 
  61.       Align           =   2  'Align Bottom
  62.       Alignment       =   1  'Left Justify - MIDDLE
  63.       AutoSize        =   3  'AutoSize Child To Panel
  64.       BackColor       =   &H00C0C0C0&
  65.       Caption         =   "Ok."
  66.       Font3D          =   3  'Inset w/light shading
  67.       Height          =   255
  68.       Left            =   0
  69.       TabIndex        =   7
  70.       Top             =   3645
  71.       Width           =   7365
  72.    End
  73.    Begin SSFrame FrameResponses 
  74.       Alignment       =   2  'Center
  75.       Font3D          =   2  'Raised w/heavy shading
  76.       Height          =   2175
  77.       Left            =   120
  78.       TabIndex        =   5
  79.       Top             =   960
  80.       Width           =   7095
  81.       Begin ListBox ListResponses 
  82.          Height          =   1785
  83.          Left            =   120
  84.          TabIndex        =   6
  85.          Top             =   240
  86.          Width           =   6855
  87.       End
  88.    End
  89.    Begin ComboBox ComboServers 
  90.       BackColor       =   &H00C0C0C0&
  91.       Height          =   300
  92.       Left            =   4560
  93.       TabIndex        =   3
  94.       Top             =   600
  95.       Width           =   2655
  96.    End
  97.    Begin SSPanel PanelQuery 
  98.       Alignment       =   6  'Center - TOP
  99.       AutoSize        =   3  'AutoSize Child To Panel
  100.       BackColor       =   &H00C0C0C0&
  101.       Font3D          =   4  'Inset w/heavy shading
  102.       Height          =   300
  103.       Left            =   720
  104.       TabIndex        =   1
  105.       Top             =   600
  106.       Width           =   3735
  107.       Begin TextBox TextQuery 
  108.          BackColor       =   &H00C0C0C0&
  109.          BorderStyle     =   0  'None
  110.          Height          =   270
  111.          Left            =   15
  112.          MaxLength       =   128
  113.          TabIndex        =   4
  114.          Text            =   "?"
  115.          Top             =   15
  116.          Width           =   3705
  117.       End
  118.    End
  119.    Begin Label Label2 
  120.       BackColor       =   &H00C0C0C0&
  121.       BackStyle       =   0  'Transparent
  122.       Caption         =   "Whois:"
  123.       FontBold        =   0   'False
  124.       FontItalic      =   0   'False
  125.       FontName        =   "MS Sans Serif"
  126.       FontSize        =   8.25
  127.       FontStrikethru  =   0   'False
  128.       FontUnderline   =   0   'False
  129.       Height          =   255
  130.       Left            =   120
  131.       TabIndex        =   2
  132.       Top             =   600
  133.       Width           =   615
  134.    End
  135.    Begin Menu MenuAbout 
  136.       Caption         =   "&About"
  137.    End
  138. End
  139. Option Explicit
  140.  
  141. Dim igServersCount As Integer
  142.  
  143. Sub CancelQuery ()
  144.  
  145.     On Error Resume Next
  146.  
  147.     TextQuery.Enabled = True
  148.     ComboServers.Enabled = True
  149.  
  150.     Main.MousePointer = 0
  151.     PanelLocalName.MousePointer = 2
  152.     StatusBar.MousePointer = 0
  153.     
  154.     NetClient.Connect = False
  155.  
  156.     StatusBar.Caption = "Query canceled."
  157.  
  158. End Sub
  159.  
  160. Sub ComboServers_Click ()
  161. Dim sHost As String
  162.  
  163.     If ComboServers.ListIndex = -1 Then Exit Sub
  164.     sHost = ComboServers.List(ComboServers.ListIndex)
  165.     NetClient.HostName = sHost
  166.     If NetClient.HostName = "" Then
  167.         NetClient.HostAddr = sHost
  168.     End If
  169.     
  170. End Sub
  171.  
  172. Sub ComboServers_KeyPress (KeyAscii As Integer)
  173.  
  174.     If KeyAscii = 13 Then
  175.         NetClient.HostName = ComboServers.Text
  176.         If NetClient.HostName = "" Then
  177.             NetClient.HostAddr = ComboServers.Text
  178.             If NetClient.HostAddr = "" Then
  179.                 StatusBar = "Unknown host: " + ComboServers.Text
  180.                 ComboServers.ListIndex = ComboServers.NewIndex
  181.                 Exit Sub
  182.             End If
  183.         End If
  184.         ComboServers.AddItem ComboServers.Text
  185.         ComboServers.ListIndex = ComboServers.NewIndex
  186.         
  187.         Ini.Filename = "winwhois.ini"
  188.         Ini.Section = "Servers"
  189.         Ini.Entry = "Server" + Right$(Str$(igServersCount), Len(Str$(igServersCount)) - 1)
  190.         Ini.Value = ComboServers.Text
  191.  
  192.         igServersCount = igServersCount + 1
  193.  
  194.         KeyAscii = 0
  195.     End If
  196.  
  197. End Sub
  198.  
  199. Sub Form_Load ()
  200. Dim iIndex As Integer
  201. Dim sEntry As String
  202. Dim sValue As String
  203.  
  204.     On Error Resume Next
  205.  
  206.     If NetClient.HostName <> "" Then
  207.         PanelLocalName = NetClient.HostName
  208.         LabelLocalAddr = NetClient.HostAddr
  209.     Else
  210.         PanelLocalName = "LocalHost"
  211.         LabelLocalAddr = "Unknown Address"
  212.     End If
  213.  
  214.     ' Use "whois" service, or port #43
  215.     NetClient.RemoteService = "whois"
  216.     If NetClient.RemoteService = "" Then
  217.         NetClient.RemotePort = 43
  218.     End If
  219.  
  220.     ' Use Unix Chr$(10) Newline characters for delimiters
  221.     NetClient.LineDelimiter = "\n"
  222.  
  223.     ComboServers.Clear
  224.     Ini.Filename = "winwhois.ini"
  225.     Ini.Section = "Servers"
  226.     Ini.Default = ""
  227.     iIndex = 0
  228.      
  229.     Ini.Entry = "Server" + Right$(Str$(iIndex), Len(Str$(iIndex)) - 1)
  230.  
  231.     sValue = Ini.Value
  232.     While sValue <> ""
  233.         ComboServers.AddItem sValue
  234.         iIndex = iIndex + 1
  235.         Ini.Entry = "Server" + Right$(Str$(iIndex), Len(Str$(iIndex)) - 1)
  236.         sValue = Ini.Value
  237.     Wend
  238.  
  239.     ' Automatically select the previously used one!
  240.     Ini.Entry = "Selected"
  241.     Ini.Default = "0"
  242.     ComboServers.ListIndex = Val(Ini.Value)
  243.     
  244.     If iIndex > 0 Then ComboServers.ListIndex = 0
  245.     
  246.     igServersCount = iIndex
  247.  
  248.     Ini.Section = "Windows"
  249.     Main.Top = gfMISCIniGetInt("Main.Top", (Main.Top))
  250.     Main.Left = gfMISCIniGetInt("Main.Left", (Main.Left))
  251.     Main.Width = gfMISCIniGetInt("Main.Width", (Main.Width))
  252.     Main.Height = gfMISCIniGetInt("Main.Height", (Main.Height))
  253.     
  254.     Main.Show
  255.  
  256. End Sub
  257.  
  258. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  259.  
  260.     If UnloadMode = 0 Then
  261.         Ini.Section = "Windows"
  262.         gsMISCIniPutInt "Main.Top", (Main.Top)
  263.         gsMISCIniPutInt "Main.Left", (Main.Left)
  264.         gsMISCIniPutInt "Main.Width", (Main.Width)
  265.         gsMISCIniPutInt "Main.Height", (Main.Height)
  266.     End If
  267.  
  268. End Sub
  269.  
  270. Sub Form_Resize ()
  271.  
  272.     If Main.WindowState = 1 Then Exit Sub
  273.  
  274.     LabelLocalAddr.Width = Abs(ScaleWidth - 240)
  275.     FrameResponses.Width = Abs(ScaleWidth - 240)
  276.     ListResponses.Width = Abs(ScaleWidth - 480)
  277.     ComboServers.Left = Abs(ScaleWidth - ComboServers.Width - 120)
  278.     PanelQuery.Width = Abs(ScaleWidth - ComboServers.Width - 240 - PanelQuery.Left)
  279.     
  280.     FrameResponses.Height = Abs(ScaleHeight - StatusBar.Height - FrameResponses.Top - 120)
  281.     ListResponses.Height = Abs(FrameResponses.Height - 360)
  282.  
  283. End Sub
  284.  
  285. Sub Form_Unload (Cancel As Integer)
  286.  
  287.     ' Automatically select the previously used one!
  288.     Ini.Entry = "Selected"
  289.     Ini.Value = Right$(Str$(ComboServers.ListIndex), Len(ComboServers.ListIndex) - 1)
  290.     
  291. End Sub
  292.  
  293. Sub LabelLocalAddr_DblClick ()
  294.     
  295.     PanelLocalName_DblClick
  296.  
  297. End Sub
  298.  
  299. Sub MenuAbout_Click ()
  300.  
  301.     gsMISCAboutLoad "About WinWhois", "WinWhois v1.1", "This client application queries Whois servers (typically port 43). SERVERS.TXT includes a list of all publically known Whois hosts."
  302.  
  303. End Sub
  304.  
  305. Sub NetClient_OnClose ()
  306.     
  307.     On Error Resume Next
  308.  
  309.     TextQuery.Enabled = True
  310.     ComboServers.Enabled = True
  311.  
  312.     CancelQuery
  313.  
  314.     StatusBar = "Ok."
  315.  
  316. End Sub
  317.  
  318. Sub NetClient_OnConnect ()
  319.  
  320.     On Error Resume Next
  321.  
  322.     StatusBar.Caption = "Connected, Sending request - Click this message to Abort."
  323.  
  324.     NetClient.SendLine = TextQuery.Text + Chr$(13) + Chr$(10)
  325.  
  326. End Sub
  327.  
  328. Sub NetClient_OnError (iErrorNumber As Integer)
  329.     
  330.     On Error Resume Next
  331.  
  332.     CancelQuery
  333.  
  334.     StatusBar.Caption = "Error" + Str$(iErrorNumber) + ": " + NetClient.ErrorMessage
  335.     
  336. End Sub
  337.  
  338. Sub NetClient_OnRecv ()
  339. Dim sLine As String
  340.  
  341.     On Error Resume Next
  342.  
  343.     sLine = NetClient.RecvLine
  344.     While sLine <> ""
  345.         Do While Right$(sLine, 1) = Chr$(13)
  346.             sLine = Left$(sLine, Len(sLine) - 1)
  347.             If sLine = "" Then Exit Do
  348.         Loop
  349.         ListResponses.AddItem sLine
  350.         sLine = NetClient.RecvLine
  351.     Wend
  352.  
  353. End Sub
  354.  
  355. Sub PanelLocalName_DblClick ()
  356.     
  357.     PanelLocalName.BevelOuter = 1
  358.     PanelLocalName.Font3D = 2
  359.     WhoisQuery
  360.     PanelLocalName.Font3D = 1
  361.     PanelLocalName.BevelOuter = 2
  362.  
  363. End Sub
  364.  
  365. Sub StatusBar_Click ()
  366.  
  367.     StatusBar.BevelOuter = 1
  368.     
  369.     CancelQuery
  370.     
  371.     StatusBar.BevelOuter = 2
  372.  
  373. End Sub
  374.  
  375. Sub TextQuery_GotFocus ()
  376.     PanelQuery.BevelOuter = 1
  377.     TextQuery.SelStart = 0
  378.     TextQuery.SelLength = 128
  379. End Sub
  380.  
  381. Sub TextQuery_KeyPress (KeyAscii As Integer)
  382.  
  383.     If KeyAscii = 13 Then
  384.  
  385.         WhoisQuery
  386.  
  387.         KeyAscii = 0
  388.     End If
  389. End Sub
  390.  
  391. Sub TextQuery_LostFocus ()
  392.     PanelQuery.BevelOuter = 2
  393. End Sub
  394.  
  395. Sub WhoisQuery ()
  396.     
  397.     On Error Resume Next
  398.  
  399.     If NetClient.HostName = "" Then
  400.         StatusBar.Caption = "No valid Whois server specified!"
  401.         Exit Sub
  402.     End If
  403.         
  404.     ListResponses.Clear
  405.     ListResponses.SetFocus
  406.  
  407.     StatusBar.Caption = "Initiating Query - Click this message to Abort."
  408.     
  409.     TextQuery.Enabled = False
  410.     ComboServers.Enabled = False
  411.     
  412.     Main.MousePointer = 11
  413.     PanelLocalName.MousePointer = 12
  414.     StatusBar.MousePointer = 2
  415.     
  416.     NetClient.Connect = True
  417.  
  418. End Sub
  419.  
  420.